package com.gc.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.InventorySizeMapper;
import com.gc.business.domain.InventorySize;
import com.gc.business.service.IInventorySizeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 库存规格管理 服务层实现
 * 
 * @author hruiyan
 * @date 2020-11-10
 */
@Slf4j
@Service
public class InventorySizeServiceImpl extends ServiceImpl<InventorySizeMapper, InventorySize> implements IInventorySizeService {

    @Override
    public List<InventorySize> list(InventorySize inventorySize){
        LambdaQueryWrapper<InventorySize> wrapper = new LambdaQueryWrapper<>();
        if(inventorySize != null){
            if(StringUtils.isNotEmpty(inventorySize.getSizeId())){
                wrapper.eq(InventorySize::getSizeId, inventorySize.getSizeId());
            }
            if(StringUtils.isNotEmpty(inventorySize.getAttrId())){
                wrapper.eq(InventorySize::getAttrId, inventorySize.getAttrId());
            }
            if(StringUtils.isNotEmpty(inventorySize.getSizeTitle())){
                wrapper.like(InventorySize::getSizeTitle, inventorySize.getSizeTitle());
            }
            if(StringUtils.isNotEmpty(inventorySize.getCreateBy())){
                wrapper.like(InventorySize::getCreateBy, inventorySize.getCreateBy());
            }
            if(StringUtils.isNotEmpty(inventorySize.getCreateTime())){
                wrapper.eq(InventorySize::getCreateTime, inventorySize.getCreateTime());
            }
            if(StringUtils.isNotEmpty(inventorySize.getUpdateBy())){
                wrapper.like(InventorySize::getUpdateBy, inventorySize.getUpdateBy());
            }
            if(StringUtils.isNotEmpty(inventorySize.getUpdateTime())){
                wrapper.eq(InventorySize::getUpdateTime, inventorySize.getUpdateTime());
            }
            if(StringUtils.isNotEmpty(inventorySize.getRemark())){
                wrapper.like(InventorySize::getRemark, inventorySize.getRemark());
            }
        }
        return baseMapper.selectList(wrapper);
    }
}
